#include <joyos.h>
#include <happylib.h>

#include "define.h"
#include "robomove.h"

/**
 * "blinkLED" controls decoration LEDs to blink
 * LEDs uses a motor port to activate blinking
 *
 * @requires none
 * @effects the attached LEDs are blinked
 * @modifies none
 */
int blinkLED(void){
	motorSetVel(MOTOR_PORT_TOWER, 255);
	int i = 0;
	int count = 0;
	while(1){
		if(i>=255){
			count = -10;
		}else if(i<=255){
			count = 10;
		}	
		motorSetVel(MOTOR_PORT_LED, i);
		pause(50);
		motorSetVel(MOTOR_PORT_LED, i);
		i+=count;		
	}
	return 0;
}

/**
 * "fantasy" creates a thread for artistic decoration for the robot
 *
 * @requires none
 * @effects decoration thread(s) is(are) activated
 * @modifies none
 */
void fantasy(void){
	int (*blinkpt)(void) = blinkLED;
	create_thread(blinkpt,1000, 255, "Blink");
}
